<%@ page language="java" contentType="text/html;charset=UTF-8"
   	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<LINK REL="SHORTCUT ICON" HREF="images/icon.jpg"> 
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body>
<form action="search_courses.html" method="post">
<table cellpadding="0" width="690" cellspacing="0" border="0" align="center">
		<tr>
			<td align="left">
				<table width="100%" border="0"  cellpadding="0" cellspacing="0">
					<tr>
						<td width="10%">សូមបញ្ចូលពាក្យគន្លឹះ&nbsp;</td>
						<td width="30%"><input type="text" name="txtkeyword" value="${keywords}" style="width:200px;height:16px;"/></td>
						<td width="30%">
							<select name="txtcat" style="height:22px;">
								<option value="0">All Categories</option>
								<c:forEach var="y" begin="0" end="${fn:length(categories)-1 }" step="1" varStatus="status">
									<option value="${categories[y].CATEGORY_ID}">
										<c:out value="${categories[y].CATEGORY_NAME}"></c:out>
									</option>
								</c:forEach>	
							</select>
						</td>
						<td>&nbsp;&nbsp;<input type="submit" value="ស្វែងរក" class="input_button" style=" height:23px;"></td>
					</tr>
				</table>
			</td>
		</tr>
	<tr><td>&nbsp;</td></tr>
	<tr>
			<td valign="middle" align="left" height="25" class="tableheader"​ style="border: #AAA solid 1px;">លទ្ធផលរកឃើញ</td>
	</tr>
	<tr><td height="10"​ style="border-right: #CCC solid 1px;border-left: #CCC solid 1px;">&nbsp;</td></tr>
	<c:choose>
		<c:when test="${(fn:length(courses))>=1}">
			<c:forEach var="i" begin="0" end="${fn:length(courses)-1}" step="1" varStatus ="status">
			<tr>
				<td align="left" style="padding-left: 10px; padding-right:10px; border-right: #CCC solid 1px;border-left: #CCC solid 1px;">
					<a href="view_course.html?course_id=${courses[i].COURSE_ID}"><b><c:out value="${courses[i].COURSE_NAME}"></c:out></b></a><br>
							<p style="font-size:11px;line-height:15px;">	
								<c:choose>
									<c:when test="${fn:length(courses[i].COURSE_DESC)>=350}">
										<c:out value="${fn:substring(courses[i].COURSE_DESC,0,350)}"/>...
									</c:when>
									<c:otherwise>
										<c:out value="${courses[i].COURSE_DESC}"/>
									</c:otherwise>
								</c:choose>
							</p>
				</td>
			</tr>
			<tr><td height="10" style="border-right: #CCC solid 1px;border-left: #CCC solid 1px;">&nbsp;</td></tr>
			</c:forEach>
			<tr><td height="10" style="border-top: #CCC solid 1px;">&nbsp;</td></tr>
		</c:when>
		<c:otherwise>
			<tr​>
				<td align="center" width="720" style="padding-left: 10px; padding-right:10px; border-right: #CCC solid 1px;border-left: #CCC solid 1px;">សូមអភ័យទោស ពុំមានលទ្ធផលសំរាប់បង្ហាញទេ</td>
			</tr>
			<tr><td height="10" style="border-top: #CCC solid 1px;">&nbsp;</td></tr>
		</c:otherwise>
	</c:choose>
</table>
</form>
</body>
</html>